package com.putong35.easyui.search;

import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.putong35.easyui.R;

/**
 * 搜索结果界面
 *
 * @Author: ${USER}
 * @E-mail: pengveivei@sina.cn
 * @CreateDate: ${DATE} ${TIME}
 * @Version: 1.0.0
 */
public class ResultFragment extends Fragment implements OnSearchKeyChangedListener {
    private String searchKey;
    private TextView tvSearchResult;
    public ResultFragment() {
        // Required empty public constructor
    }

    public static ResultFragment newInstance(String param1, String param2) {
        ResultFragment fragment = new ResultFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.search_fragment_result, container, false);
        tvSearchResult = (TextView) view.findViewById(R.id.tvSearchResult);
        return view;
    }

    public void onSearchKeyChanged(String searchKey) {
        this.searchKey = searchKey;
        tvSearchResult.setText("result " + searchKey);
        // TODO do key change thing
    }
}
